<%@page import="board.BoardVo"%>
<%@page import="java.util.Vector"%>
<%@page import="board.Board"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<style>
#aa{
   width: 630px;
   border: 1px solid #b75;

}

#list{
   margin-bottom: 10px;
}

#line{
   border-bottom: 1px solid #b75;
   width: 630px;
   margin: 10px;
}

#list_num{display: inline-block; width: 100px;border: 1px solid #b75; border-bottom-width:7px; border-radius:5px; }
#list_mid{display: inline-block; width: 100px;border: 1px solid #b75; border-bottom-width:7px; border-radius:5px;}
#list_subject{display: inline-block; width: 200px;border: 1px solid #b75; border-bottom-width:7px; border-radius:5px;}
#list_date{display: inline-block; width: 100px;border: 1px solid #b75; border-bottom-width:7px; border-radius:5px;}
#list_hit{display: inline-block; width: 100px;border: 1px solid #b75; border-bottom-width:7px; border-radius:5px;}
#list_line{border-bottom: 1px solid #b75; width: 630px; margin: 10px; border-width: 5px;}

#item_num{display: inline-block; width: 100px;}
#item_mid{display: inline-block; width: 100px;}
#item_subject{display: inline-block; width: 200px;}
#item_date{display: inline-block; width: 100px;}
#item_hit{display: inline-block; width: 100px;}

#search{width: 650px;}
#search_search{}
#search_write{display: inline-block;}

#totsize{
   width: 630px;
}

a:HOVER {
   color:#b75;
}
</style>

<script>
function register(){
   location.href="index2.jsp?inc_content=./board/register.jsp";
}

function goPage(page){
   var ff = document.search_form;
   ff.nowPage.value = page;
   ff.action = "index2.jsp?inc_content=./board/list.jsp";
   ff.submit();
}
</script>
</head>
<body>
<jsp:useBean id="boardVo" class="board.BoardVo"></jsp:useBean>
<jsp:setProperty property="*" name="boardVo"/>

<%
String part = (String)session.getAttribute("part"); 
boardVo.setPart("공지사항");

Board board = new Board();
board.setVo(boardVo);
board.setNowPage(boardVo.getNowPage());
Vector<BoardVo> v = board.list();

%>

<div align="center">
   <div id="list" align="center">
      <h1>게 시 판(<%=part %>)</h1>
      <div id="totsize" align="right">전체 건수 : <%=board.getTotSize() %></div>
         <div id="list_num">글번호</div>
         <div id="list_subject">제목</div>
         <div id="list_mid">작성자</div>
         <div id="list_date">날짜</div>
         <div id="list_hit">조회수</div>
      <div id="list_line"></div>
   </div>

   <%
      for(int i=0; i<v.size(); i++){
         BoardVo vo = v.get(i);
   %>
   <div id="item" align="center">
   <%if(vo.getSerial() == vo.getGrp()){ %>
      <div id="item_num"><%=vo.getSerial() %></div>
      <div id="item_subject" align="left">
      
         <a href="index2.jsp?inc_content=./board/view.jsp&serial=<%=vo.getSerial() %>" style="text-decoration:none"><%=vo.getSubject() %></a>
         <%}else{ %>
         <div id="item_num"></div>
      <div id="item_subject" align="left">
         &nbsp;
         <a href="index2.jsp?inc_content=./board/view.jsp&serial=<%=vo.getSerial() %>" style="text-decoration:none">└<%=vo.getSubject() %></a>
         <%} %>
      </div>
      <div id="item_mid"><%=vo.getMid() %></div>
      <div id="item_date"><%=vo.getMdate() %></div>
      <div id="item_hit"><%=vo.getHit()%></div>
      <%
         if (i < v.size()-1) {
      %>
      <div id="line"></div>
      <%
         } else {
      %>
      <div id="list_line"></div>
      <%
         }
      %>
   </div>
   <%
      }
   %>
   <div align="center">
   <%if(board.getNowBlock()>1){ %>
   <input type="button" value="맨 처음" onclick="goPage(1)">
   <input type="button" value="이전" onclick="goPage(<%=board.getStartPage()-1%>)">
   <%} %>
   [
   <%for(int p=board.getStartPage(); p<=board.getEndPage(); p++){ %>
   <input type="button" value="<%=p %>" onclick="goPage(<%=p%>)">
   <%} %>
   ]
   <%if(board.getNowBlock() < board.getTotBlock() ){ %>
   <input type="button" value="다음" onclick="goPage(<%=board.getEndPage()+1%>)">
   <input type="button" value="맨끝" onclick="goPage(<%=board.getTotPage()%>)">
   <%} %>
   </div>

   


   </p>
   <form name="search_form" method="post" action="index2.jsp?inc_content=./board/list.jsp">
      <div id="search_search" align="center">
            <input type="search" name="find" id="find" value="<%=boardVo.getFind()%>">
            <input type="submit" value="검색">

            <input type="button" value="글쓰기" onclick="register()">
            <input type="hidden" name="nowPage" value="<%=board.getNowPage()%>">
      </div>
   </form>
   </div>
   </div>
</body>
</html>